package com.ocom.webapi.feign;

import com.alibaba.fastjson.JSONObject;
import com.ocom.common.constant.AccessServiceUrl;
import com.ocom.common.entity.access.EntityMjYkm;
import com.ocom.common.entity.access.EntityMjZoneDate;
import com.ocom.common.entity.master.EntityDeviceLogin;
import com.ocom.common.entity.master.EntityFileDownloadInfo;
import com.ocom.common.request.web.GetZoneDateListRequest;
import com.ocom.common.request.web.PersonnelAreaRequest;
import com.ocom.common.request.wx.UserAccessPageSetAccessRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.vo.AreaVo;
import com.ocom.common.vo.ImportMachVo;
import com.ocom.common.vo.access.GroupVo;
import com.ocom.common.vo.access.TimeInfoVo;
import com.ocom.webapi.vo.filedownload.GetDownLoadListVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


@FeignClient(value = "access")
public interface AccessClientService {

    /**
     * 添加区域
     * */
    @PostMapping(AccessServiceUrl.URL_NewArea)
    public Result NewArea(@RequestBody Map<String, Object> map);

    /**
     * 更新区域
     * */
    @PostMapping(AccessServiceUrl.URL_UpdateAreaName)
    public Result UpdateAreaName(@RequestBody Map<String, Object> map);


    /**
     * 获取粤康码规则信息（Ykm/info）
     * */
    @GetMapping(AccessServiceUrl.URL_YkmInfo)
    public Result YkmInfo(@RequestParam("comId")Long comId,@RequestParam("areaId")Long areaId);

    //添加/修改粤康码规则信息（Ykm/modify）
    @PostMapping(AccessServiceUrl.URL_YkmModify)
    public Result YkmModify(@RequestBody EntityMjYkm entityMjYkm);

    /**
     * 移除区域
     * */
    @PostMapping(AccessServiceUrl.URL_RemoveArea)
    public Result RemoveArea(@RequestBody Map<String, Object> map);

    /**
     *  按出厂号登记设备（bindMachVo）
     * */
    @PostMapping(AccessServiceUrl.URL_BindMach)
    public Result BindMach(@RequestBody Map<String, Object> map);

    /**
     *  按出厂号导入登记设备（bindMachVo）
     * */
    @PostMapping(AccessServiceUrl.URL_ImportMach)
    public Result ImportMach(@RequestBody List<ImportMachVo> importMachVos);


    /**
     *  修改设备（updateMach）
     * */
    @PostMapping(AccessServiceUrl.URL_UpdateMach)
    public Result UpdateMach(@RequestBody Map<String, Object> map);


    /**
     *  修改安装位置（changeMachPlace）
     * */
    @PostMapping(AccessServiceUrl.URL_ChangeMachPlace)
    public Result ChangeMachPlace(@RequestBody Map<String, Object> map);

    /**
     * 查询设备列表（searchMachList）
     * */
    @PostMapping(AccessServiceUrl.URL_SearchMachList)
    public Result SearchMachList(@RequestBody Map<String, Object> map);


    /**
     *  移除设备（removeMach）
     * */
    @PostMapping(AccessServiceUrl.URL_RemoveMach)
    public Result RemoveMach(@RequestParam("deviceNo") String deviceNo,@RequestParam("comId") Long comId,@RequestParam("pId") Integer pId);

    /**
     * 获取门禁区域信息
     * */
    @PostMapping(AccessServiceUrl.URL_GetAreaList)
    public Result  GetAreaList(@RequestBody AreaVo areaVo);

    /**
     * 门禁设备列表（AccessDevice/allOnShow）
     * */
    @PostMapping(AccessServiceUrl.URL_FindMach)
    public Result FindMach(@RequestBody Map<String, Object> map);

    /*
     * @Description: 人员门禁权限列表
     * @Author: lu
     * @Date: 2022/1/12 10:53
     * @param companyId: 单位编号
     * @param pId: 人员编号
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_WxGetAccessByUser)
    public Result getAccessByUser(@RequestParam("companyId")Long companyId,@RequestParam("pId")Long pId);

    /*
     * @Description:人员门禁权限新增/修改
     * @Author: lu 
     * @Date: 2022/1/12 16:00
     * @param request:  
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_WxChangeAccess)
    public Result getAccess(@RequestBody UserAccessPageSetAccessRequest request);

    /*
     * @Description:获取时区列表
     * @Author: lu 
     * @Date: 2022/1/14 13:51
     * @param companyId:  
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_getZoneList)
    public Result getZoneList(@RequestParam("companyId")Long companyId);

    /*
     * @Description:获取时区设置列表
     * @Author: lu 
     * @Date: 2022/1/14 13:51
     * @param getZoneDateListRequest:  
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_getZoneDateList)
    public Result getZoneDateList(@RequestBody GetZoneDateListRequest getZoneDateListRequest);


    /*
     * @Description:设置日期时区
     * @Author: lu 
     * @Date: 2022/1/14 14:11
     * @param entityMjZoneDate:  
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_setDateZone)
    public Result setDateZone(@RequestBody EntityMjZoneDate entityMjZoneDate);

    /*
     * @Description:删除日期时区
     * @Author: lu
     * @Date: 2022/1/14 16:38
     * @param entityMjZoneDate:
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_removeDateZone)
    public Result removeDateZone(@RequestBody EntityMjZoneDate entityMjZoneDate);

    /**
     * 设备升级（machUpgrade）
     * */
    @PostMapping(AccessServiceUrl.URL_MachUpgrade)
    public Result MachUpgrade(@RequestBody Map<String, Object> map);

    /**
     * @param areaNo:  
     * @return: com.ocom.common.resp.Result
     **/
    @PostMapping(AccessServiceUrl.URL_getGroupListByArea)
    public Result getGroupListByArea(@RequestParam("companyId") Long companyId,@RequestParam("areaNo") Long areaNo);


    /**获取区域信息*/
    @GetMapping(AccessServiceUrl.URL_GetAreaInfo)
    public Result GetAreaInfo(@RequestParam("comId") Long comId,@RequestParam("regionId")Integer regionId,@RequestParam("areaId") Integer areaId,@RequestParam("areaName") String areaName);



    @PostMapping(AccessServiceUrl.URL_clearAccessByUser)
    Result clearAccessByUser(@RequestParam("companyId")Long companyId,@RequestParam("pId") Long pId,@RequestParam("userId") Long userId);

    /**
     * 获取登录账号（getLoginAccount）
     * */
    @PostMapping(AccessServiceUrl.URL_GetLoginAccount)
    public Result GetLoginAccount(@RequestBody Map<String, Object> map);

    /**
     * 修改登录账号（updateLoginAccount）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_UpdateLoginAccount)
    public Result UpdateLoginAccount(@RequestBody EntityDeviceLogin deviceLogin);

    /**
     * 新增登录账号（addLoginAccount）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_AddLoginAccount)
    public Result AddLoginAccount(@RequestBody EntityDeviceLogin deviceLogin);

    /**
     * 删除登录账号（deleteLoginAccount）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_DeleteLoginAccount)
    public Result DeleteLoginAccount(@RequestParam("comId")Long comId,@RequestParam("ids")String ids);

    /**
     * 健康码人数（LargeScreen/getYkmNums）
     */
    @GetMapping(AccessServiceUrl.URL_LargeScreenGetYkmNums)

    Result LargeScreenGetYkmNums(@RequestParam("comId")Long comId);

    /**
     * 删除中台配置信息（deleteCenterConfig）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_DeleteCenterConfig)
    public Result DeleteCenterConfig(@RequestParam("comId")Long comId, @RequestParam("ids")String ids);

    /**
     * 修改中台配置信息（updateCenterConfig）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_UpdateCenterConfig)
    public Result UpdateCenterConfig(@RequestBody Map<String, Object> map);

    /**
     * 新增中台配置信息（addCenterConfig）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_AddCenterConfig)
    public Result AddCenterConfig(@RequestBody Map<String, Object> map);

    /**
     * 获取中台配置信息（getCenterConfig）【WEB】
     * */
    @PostMapping(AccessServiceUrl.URL_GetCenterConfig)
    public Result GetCenterConfig(@RequestBody Map<String, Object> map);


    /**
     * 核酸检测归类统计（LargeScreen/getYkmSumByHS）
     * */
    @GetMapping(AccessServiceUrl.URL_LargeScreenGetYkmSumByHS)
    Result LargeScreenGetYkmSumByHS(@RequestParam("comId")Long comId);


    /**
     * 疫苗接种归类统计（LargeScreen/getYkmSumByYM）
     * */
    @GetMapping(AccessServiceUrl.URL_LargeScreenGetYkmSumByYM)
    Result LargeScreenGetYkmSumByYM(@RequestParam("comId")Long comId);

    // 更改设备参数状态（需下发）（setMachParaState）
    @PostMapping(value = AccessServiceUrl.URL_SetMachParaState)
    public Result SetMachParaState(@RequestParam("companyId")Long companyId, @RequestParam("machNo")String machNo,
                                   @RequestParam("jobId")String jobId,@RequestParam("state") Long state);


    /**
     * 获取片区信息（getRegionInfo）
     * */
    @PostMapping(AccessServiceUrl.URL_getRegionInfo)
    Result getRegionInfo(@RequestBody JSONObject object);

    //添加片区（newRegionInfo）
    @PostMapping(AccessServiceUrl.URL_newRegionInfo)
    Result newRegionInfo(@RequestBody JSONObject object);

    //修改片区（updateRegionInfo）
    @PostMapping(AccessServiceUrl.URL_updateRegionInfo)
    Result updateRegionInfo(@RequestBody JSONObject object);

    //2.2.7移除片区（removeRegionInfo）
    @PostMapping(AccessServiceUrl.URL_removeRegionInfo)
    Result removeRegionInfo(@RequestBody JSONObject object);

    //2.8.5防疫信息汇总统计（getYkmPersonnelSum）
    @PostMapping(AccessServiceUrl.URL_GetYkmPersonnelSum)
    Result getYkmPersonnelSum(@RequestBody JSONObject object);

    /**
     * 防疫人员列表（getYkmPersonnelList）
     * */
    @PostMapping(AccessServiceUrl.URL_GetYkmPersonnelList)
    public Result GetYkmPersonnelList(@RequestBody Map<String,Object> map);


    /**
     * 防疫汇总指标列表详情（getYkmSumList）
     * */
    @PostMapping(AccessServiceUrl.URL_getYkmSumList)
    public Result getYkmSumList(@RequestBody Map<String,Object> map);

    /**
     * 更改文件状态 （/updateFileStatus)
     */
    @PostMapping(AccessServiceUrl.URL_UpdateFileStatus)
    public Result UpdateFileStatus(@RequestBody Map<String,Object> map);

    /**
     * 添加文件下载申请 （/sendExcelApply）
     * */
    @PostMapping(AccessServiceUrl.URL_SendExcelApply)
    public Result SendExcelApply(@RequestBody Map<String,Object> map);

    /**
     * 获取列表 （/getDownLoadList）
     * */
    @PostMapping(AccessServiceUrl.URL_GetDownLoadList)
    public Result GetDownLoadList(@Validated @RequestBody GetDownLoadListVo getDownLoadListVo);


    @PostMapping(AccessServiceUrl.URL_UpdateFileStatus)
    public Result UpdateFileStatus(@RequestBody EntityFileDownloadInfo entityFileDownloadInfo);


    @PostMapping(AccessServiceUrl.URL_SendExcelApply)
    public Result SendExcelApply(@RequestBody EntityFileDownloadInfo entityFileDownloadInfo);

    /**
     * 区域权限列表 （getAreaGroupList）
     * */
    @PostMapping(AccessServiceUrl.URL_GetAreaGroupList)
    public Result  GetAreaGroupList(@RequestBody Map<String,Object> map);

    /**
     * 在校人数统计
     * */
    @PostMapping(AccessServiceUrl.URL_GetStudentSumBySchool)
    public Result getStudentSumBySchool(@RequestParam("companyId")Long companyId);


    @PostMapping(AccessServiceUrl.URL_getNhResult)
    public Result getNH(@RequestParam("comId")Long comId);

    @PostMapping(AccessServiceUrl.URL_getNhCount)
    public Result getNhCount(@RequestParam("comId")Long comId);

    // 重置门禁下传状态 (/mach/reset)
    @PostMapping(AccessServiceUrl.URL_MachReset)
    public Result MachReset(@RequestParam("comId")Long comId,@RequestParam("machNo") String machNo);

    @PostMapping(AccessServiceUrl.URL_AccessGetWhiteUser)
    public Result getWhiteUser(@RequestParam("companyId")Long companyId,@RequestParam("pId")Long pId);

    //获取权限组列表
    @PostMapping(AccessServiceUrl.URL_GetGroupTimeList)
    public Result getGroupTimeList(@RequestParam("companyID") Long companyID,@RequestParam("areaNo") String areaNo);

    //添加权限组
    @PostMapping(AccessServiceUrl.URL_addAccessGroup)
    public Result addAccessGroup(@RequestBody @Validated GroupVo groupVo);

    //修改权限组名称（modifyGroupName）
    @PostMapping(AccessServiceUrl.URL_modifyGroupName)
    public Result modifyGroupName(@RequestBody @Validated  GroupVo groupVo);

    //获取开门时段
    @PostMapping(AccessServiceUrl.URL_getAccessTimeSlots)
    public Result getAccessTimeSlots(@RequestBody @Validated TimeInfoVo timeInfoVo);

    //设置开门时段
    @PostMapping(AccessServiceUrl.URL_setAccessTimeSlots)
    public Result setAccessTimeSlots(@RequestBody TimeInfoVo timeInfoVo);

    //区域人员权限列表
    @PostMapping(AccessServiceUrl.URL_getAreaAccessList)
    public Result getAreaAccessList(@RequestBody @Validated PersonnelAreaRequest personnelAreaRequest);

    @PostMapping(AccessServiceUrl.URL_WxChangeAccess)
    public Result setAccess(@RequestBody UserAccessPageSetAccessRequest request);

    @PostMapping(AccessServiceUrl.Url_delSession)
    public Result delSession(@RequestParam("comId") Long comId);
}
